package com.demo.salary.transactionimplementation;

import com.demo.salary.abstracttransactions.ChangeAffiliationTransaction;
import com.demo.salary.payrolldomain.Affiliation;
import com.demo.salary.payrolldomain.Employee;
import com.demo.salary.payrolldatabase.PayrollDatabase;
import com.demo.salary.payrollimplementation.UnionAffiliation;

public class ChangeMemberTransaction extends ChangeAffiliationTransaction {

    double dues;
    int memberId;

    public ChangeMemberTransaction(int empId, int memberId, double dues) {
        super(empId);
        this.dues = dues;
        this.memberId = memberId;
    }

    @Override
    Affiliation getAffiliation() {
        return new UnionAffiliation(memberId,dues);
    }

    @Override
    void recordMembership(Employee employee) {
        PayrollDatabase.addUnionMember(memberId,employee);
    }
}
